<template>
	<view class="record">
		<view class="header">
			<view class="top">
				<image :src="query.image" mode="aspectFill" class="img"></image>
				<view class="top_right">
					<view class="first_box">
						<view class="name">
							{{query.title}}
						</view>
						<view class="right_first" @click.stop="$ROUTELINK('/pageA/course/detail?course=' + query.course)">
							<view class="size">
								课程详情
							</view>
							<u-icon name="arrow-right" color="#999999" size="14"></u-icon>
						</view>
					</view>
					<view class="content" v-if="query.form == 'unfinished'">
						<text class="color1">第</text>
						<text class="color2">{{query.ynmt}}</text>
						<text class="color1">丨共{{item.classes}}节</text>
					</view>
					<view class="content" v-else>
						<text class="color1">已完成{{query.classes}}节</text>
					</view>
				</view>
			</view>
			<view class="bottom">
				<view class="row_bottom mb">
					<view class="left">
						上课场地
					</view>
					<view class="right">
						{{query.shop_name}}
					</view>
				</view>
				<view class="row_bottom ">
					<view class="left">
						上课教练
					</view>
					<view class="right">
						<image :src="query.coach_avatar" mode="" class="coach"></image>
						<text>{{query.coach_nickname}}</text>
					</view>
				</view>
			</view>
		</view>
		<scroll-view scroll-y="true" class="scroll-Y">
			<view class="comlum_Y" v-if="query.log.length">
				<view v-for="(item,index) in query.log" :key="index" class="Item">
					<view class="header_top">
						<view class="top_left">
							{{item.that_str}}
						</view>
						<view class="time">
							上课时间：{{item.class_time}}
						</view>
					</view>
					<view class="Item_bottom">
						<image :src="item.coach_avatar" mode="" class="img"></image>
						<text class="size">{{item.coach_nickname}}</text>
					</view>
				</view>
			</view>
			<empty v-else :content="'上课记录'"></empty>
		</scroll-view>
	</view>
</template>

<script>
	import {
		coachstudentinfo
	} from '@/api/coach.js'
	import empty from './components/empty.vue'
	export default {
		components: {
			empty
		},
		data() {
			return {
				query: {
					log: []
				},
			}
		},
		onLoad(e) {
			this.getcoachstudentinfo(e)
		},
		methods: {
			getcoachstudentinfo(e) {
				coachstudentinfo(e).then(({
					data: res
				}) => {
					console.log('res', res);
					if (res.code == 1) {
						this.query = res.data
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #e9e9e9;
	}

	.record {
		display: flex;
		flex-direction: column;
		align-items: center;
		padding-top: 24rpx;

		.header {
			width: 702rpx;
			height: 328rpx;
			background: #ffffff;
			border-radius: 16rpx;
			padding: 32rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			margin-bottom: 20rpx;

			.top {
				display: flex;
				flex-direction: row;
				width: 100%;
				padding-bottom: 30rpx;

				.img {
					width: 160rpx;
					height: 120rpx;
					background: rgba(0, 0, 0, 0.00);
					border-radius: 16rpx;
					margin-right: 20rpx;
				}

				.top_right {
					flex: 1;
					display: flex;
					flex-direction: column;

					.first_box {
						display: flex;
						flex-direction: row;
						align-items: center;

						.name {
							font-size: 32rpx;
							font-family: PingFang SC, PingFang SC-Bold;
							font-weight: 700;
							text-align: left;
							color: #333333;
							flex: 1;
						}

						.right_first {
							display: flex;
							flex-direction: row;
							align-items: center;

							.size {
								font-size: 24rpx;
								font-family: PingFang SC, PingFang SC-Medium;
								font-weight: 500;
								text-align: left;
								color: #999999;
								margin-right: 7rpx;
							}
						}
					}

					.content {
						margin-top: 8rpx;
						display: flex;
						flex-direction: row;
						align-items: center;
						font-size: 24rpx;
						font-family: PingFang SC, PingFang SC-Medium;
						font-weight: 500;
						text-align: left;
						flex: 1;

						.color1 {
							color: #999999;
						}

						.color2 {
							color: #73F0EA;
						}
					}

				}
			}

			.bottom {
				width: 100%;
				display: flex;
				flex-direction: column;
				align-items: center;

				.mb {
					margin-bottom: 32rpx;
				}

				.row_bottom {
					width: 100%;
					display: flex;
					flex-direction: row;
					align-items: center;
					font-size: 28rpx;
					font-family: PingFang SC, PingFang SC-Bold;
					font-weight: 700;
					text-align: left;
					color: #333333;

					.left {
						flex: 1;
					}

					.right {
						display: flex;
						flex-direction: row;
						align-items: center;

						.coach {
							width: 40rpx;
							height: 40rpx;
							background: rgba(0, 0, 0, 0.00);
							border-radius: 50%;
							margin-right: 8rpx;
						}
					}
				}
			}
		}

		.scroll-Y {
			width: 100%;
			height: 73vh;

			.comlum_Y {
				display: flex;
				flex-direction: column;
				align-items: center;

				.Item {
					width: 702rpx;
					height: 216rpx;
					background: #ffffff;
					border-radius: 16rpx;
					padding: 24rpx 32rpx;
					display: flex;
					flex-direction: column;
					margin-bottom: 20rpx;

					.header_top {
						padding-bottom: 24rpx;
						display: flex;
						flex-direction: row;
						align-items: center;
						border-bottom: 1rpx solid #e9e9e9;

						.top_left {
							flex: 1;
							font-size: 28rpx;
							font-family: PingFang SC, PingFang SC-Bold;
							font-weight: 700;
							text-align: left;
							color: #333333;
						}

						.time {
							font-size: 24rpx;
							font-family: PingFang SC, PingFang SC-Regular;
							font-weight: 400;
							text-align: left;
							color: #666666;
						}
					}

					.Item_bottom {
						display: flex;
						flex-direction: row;
						align-items: center;
						padding-top: 26rpx;

						.img {
							width: 80rpx;
							height: 80rpx;
							background: rgba(0, 0, 0, 0.00);
							border-radius: 50%;
							margin-right: 20rpx;
						}

						.size {
							font-size: 28rpx;
							font-family: PingFang SC, PingFang SC-Medium;
							font-weight: 500;
							color: #000000;
						}
					}
				}
			}
		}
	}
</style>